#ifndef CCONFIGERINSTANCE_H
#define CCONFIGERINSTANCE_H

#include "Common/cconfigurer.h"
#include "Plugins/dirHelper/cDirHelper.h"
#include "Plugins/stringHelper/cStringHelper.h"



typedef struct _configerInstance
{
    _configerInstance()
    {
        using namespace libtool_sdk;

        std::string strFilePath = Helper::Tool_get_dll_path();
        //std::string strFilePath;
        if(strFilePath.empty())
        {
            strFilePath = Helper::Tool_get_current_dir();
        }

#ifdef _WIN32
		strFilePath = strFilePath + "\\" + INI_FILE_NAME;
        strFilePath = Helper::Tool_ReplaceStringInStd(strFilePath, "\\\\", "\\");
#else
		//strFilePath = strFilePath + "/" + INI_FILE_NAME;
        strFilePath = strFilePath + "/" + lib_tool_get_ini_file_name();
        strFilePath = Helper::Tool_ReplaceStringInStd(strFilePath, "//", "/");
#endif // WIN32        

        printf("load ini file %s\n", strFilePath.c_str());

		if (!Helper::Tool_CheckFileOrDirExsit(strFilePath.c_str()))
        {
            cConfigurer::get_instance().createIniFile(strFilePath.c_str());
            cConfigurer::get_instance().loadIniFile(strFilePath.c_str());

            // cConfigurer::get_instance().set_section_value("camera", "ip", "0.0.0.0");

            cConfigurer::get_instance().set_section_value("Log", "Enable", "1" );
			cConfigurer::get_instance().set_section_value("Log", "rootPath", "");
            //cConfigurer::get_instance().set_section_value("Log", "Display", "0" );

            cConfigurer::get_instance().set_section_value("Result", "LinkEnable", "1");

			//cConfigurer::get_instance().set_section_value("Overlay", "Enable", "1");

			//cConfigurer::get_instance().set_section_value("Filter", "ResultTimeOut", "1500");

   //         cConfigurer::get_instance().set_section_value("JPEG", "StreamEnable", "0");
   //         cConfigurer::get_instance().set_section_value("JPEG", "StreamID", "0");
        }
        else
        {
            cConfigurer::get_instance().loadIniFile(strFilePath.c_str());
        }
    }

    ~_configerInstance()
    {

    }

}configerInstance;

#endif // CCONFIGERINSTANCE_H
